{layout name="layout" /}

<div class="pd-20 text-c">
    <div class="cl pd-5 bg-1 bk-gray mt-20">
        <span class="l">
            <a href="javascript:;" onclick="del_all()" class="btn btn-danger radius">
                <i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a>
            <a class="btn btn-primary radius" href="{:url('add')}">
                <i class="Hui-iconfont">&#xe600;</i> 添加栏目</a>
        </span>
        <span class="r">共有数据：
            <strong>54</strong>条</span>
    </div>
    <div class="mt-20" style="min-width: 900px;max-width: 80%;">
        <table class="table table-border table-bordered table-hover table-bg table-sort">
            <thead>
                <tr class="text-c">
                    <th width="25">
                        <input type="checkbox" name="" value="">
                    </th>
                    <th width="80px">ID</th>
                    <th width="120px">栏目名称</th>
                    <th width="80px">内容模板</th>
                    <th width="80px">状态</th>
                    <th width="80px">排序</th>
                    <th width="240px">备注</th>
                    <th width="160px">添加时间</th>
                    <th style="min-width: 80px;">操作</th>
                </tr>
            </thead>
            <tbody>
                {foreach $data as $value}
                <tr class="text-c" id="tr_{$value.id}">
                    <td>
                        <input type="checkbox" name="checkbox[]" value="{$value.id}">
                    </td>
                    <td>{empty name="value.child"}
                        <a href="javascript:void(0);" style="text-decoration: none;">
                            <img src="/static/admin/images/subtract.gif">&nbsp;{$value.id}</a>
                        {else/}
                        <a href="javascript:void(0);" onclick="loadsuns(this,'{$value.id}')" data-stat="0" style="text-decoration: none;">
                            <img src="/static/admin/images/add.gif">&nbsp;{$value.id}</a>
                        {/empty}
                    </td>
                    <td>{$value.name}</td>
                    <td>{//$tpl_id[$value.tpl_id]}</td>
                    <td>{eq name='value.status' value='1'}正常{else/}停用{/eq}</td>
                    <td>{$value.sort}</td>
                    <td class="text-l">{$value.desc}</td>
                    <td class="text-c">{$value.mtime|date="Y-m-d H:i:s", ###}</td>
                    <td class="f-14">
                        <a title="编辑" href="{:url('edit','id='.$value.id)}" style="text-decoration:none">
                            <i class="Hui-iconfont">&#xe6df;</i>
                        </a>
                        <a title="删除" href="javascript:;" onclick="del(this,'{$value.id}')" class="ml-5" style="text-decoration:none">
                            <i class="Hui-iconfont">&#xe6e2;</i>
                        </a>
                    </td>
                </tr>
                {notempty name="value.child"} {foreach $value.child as $val}
                <tr class="text-c top-{$value.id}" style="display:none" id="tr_{$val.id}">
                    <td>
                        <input type="checkbox" name="checkbox[]" value="{$val.id}">
                    </td>
                    <td>&nbsp;&nbsp; &nbsp;&nbsp;{$val.id}</td>
                    <td>{$val.name}</td>
                    <td>{//$val.tpl_id}</td>
                    <td>{$val.status}</td>
                    <td>{$val.sort}</td>
                    <td class="text-l">{$val.desc}</td>
                    <td class="text-c">{$value.mtime|date="Y-m-d H:i:s", ###}</td>
                    <td class="f-14">
                        <a title="编辑" href="{:url('edit','id='.$val.id)}" style="text-decoration:none">
                            <i class="Hui-iconfont">&#xe6df;</i>
                        </a>
                        <a title="删除" href="javascript:;" onclick="del(this,'{$val.id}')" class="ml-5" style="text-decoration:none">
                            <i class="Hui-iconfont">&#xe6e2;</i>
                        </a>
                    </td>
                </tr>
                {/foreach} {/notempty} {/foreach}
            </tbody>
        </table>
    </div>
</div>

<script type="text/javascript">
    /*栏目-折叠/展开*/
    function loadsuns(obj, id) {
        var stat = $(obj).data('stat');
        console.log(stat);
        if (stat == 1) {
            $(".top-" + id).css("display", 'none');
            $(obj).data('stat', '0');
            $(obj).children('img').attr('src', '/static/admin/images/add.gif');
            return false;
        }
        $(obj).children('img').attr('src', '/static/admin/images/subtract.gif');
        $(".top-" + id).css("display", '');
        $(obj).data('stat', '1');
    }
</script>
<!--/请在上方写此页面业务相关的脚本-->